Optimal. Leaf size=55 \[ -\frac {c^2 x}{a}-\frac {i c^2 \log (\cos (e+f x))}{a f}+\frac {2 i c^2}{f (a+i a \tan (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45}
\begin {gather*} \frac {2 i c^2}{f (a+i a \tan (e+f x))}-\frac {i c^2 \log (\cos (e+f x))}{a f}-\frac {c^2 x}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 3568
Rule 3603
Rubi steps
\begin {align*} \int \frac {(c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\left (a^2 c^2\right ) \int \frac {\sec ^4(e+f x)}{(a+i a \tan (e+f x))^3} \, dx\\ &=-\frac {\left (i c^2\right ) \text {Subst}\left (\int \frac {a-x}{(a+x)^2} \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {\left (i c^2\right ) \text {Subst}\left (\int \left (\frac {1}{-a-x}+\frac {2 a}{(a+x)^2}\right ) \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {c^2 x}{a}-\frac {i c^2 \log (\cos (e+f x))}{a f}+\frac {2 i c^2}{f (a+i a \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.76, size = 74, normalized size = 1.35 \begin {gather*} -\frac {c^2 \left (-2+\log \left (\cos ^2(e+f x)\right )+i \left (2+\log \left (\cos ^2(e+f x)\right )\right ) \tan (e+f x)+2 \text {ArcTan}(\tan (f x)) (-i+\tan (e+f x))\right )}{2 a f (-i+\tan (e+f x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.17, size = 38, normalized size = 0.69
method | result | size |
derivativedivides | \(\frac {c^{2} \left (\frac {2}{\tan \left (f x +e \right )-i}+i \ln \left (\tan \left (f x +e \right )-i\right )\right )}{f a}\) | \(38\) |
default | \(\frac {c^{2} \left (\frac {2}{\tan \left (f x +e \right )-i}+i \ln \left (\tan \left (f x +e \right )-i\right )\right )}{f a}\) | \(38\) |
risch | \(\frac {i c^{2} {\mathrm e}^{-2 i \left (f x +e \right )}}{a f}-\frac {2 c^{2} x}{a}-\frac {2 c^{2} e}{a f}-\frac {i c^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a f}\) | \(68\) |
norman | \(\frac {\frac {2 i c^{2}}{a f}-\frac {c^{2} x}{a}+\frac {2 c^{2} \tan \left (f x +e \right )}{a f}-\frac {c^{2} x \left (\tan ^{2}\left (f x +e \right )\right )}{a}}{1+\tan ^{2}\left (f x +e \right )}+\frac {i c^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 a f}\) | \(94\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.09, size = 69, normalized size = 1.25 \begin {gather*} -\frac {{\left (2 \, c^{2} f x e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - i \, c^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{a f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.16, size = 100, normalized size = 1.82 \begin {gather*} \begin {cases} \frac {i c^{2} e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (\frac {2 c^{2}}{a} + \frac {\left (- 2 c^{2} e^{2 i e} + 2 c^{2}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {2 c^{2} x}{a} - \frac {i c^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 125 vs. \(2 (51) = 102\).
time = 0.54, size = 125, normalized size = 2.27 \begin {gather*} -\frac {\frac {i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a} - \frac {2 i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a} + \frac {i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a} + \frac {3 i \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 i \, c^{2}}{a {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.62, size = 48, normalized size = 0.87 \begin {gather*} \frac {c^2\,2{}\mathrm {i}}{a\,f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}+\frac {c^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{a\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________